$('#incollection').click(function () {
    layer.msg('数据采集中', {icon: 1});
    datatime = getLocalTime();
    var car = $('#info').html();
    //YD00001 益达 //YL00001 益隆
    var supplierName = $('#supplierNameCode').val();
    var customerName = $('#customerNameCode').val();
    var materailName = $('#materialNameCode').val();
    var time = getLocalTime();
    var measureId = $('#measureId').val();
    if(measureId==''){
        measureId = getMeasureId();
    }
    var weight = $('#sec').html();
    if(weight=='异常'){
        layer.msg('当前采集的数据为‘异常’！请确认采集服务程序是否开启', {time:30*1000});
        return false;
    }
    if(supplierName==''||customerName==''||materailName==''){
        layer.msg('供应商,采购商,物料信息必须全部填写完毕', {time:30*1000});
        return false;
    }
    //请确认业务
    if((supplierName!='益达'&&supplierName!='益隆')&&(customerName!='益达'&&customerName!='益隆')){
        layer.msg('供货商或采购商必须有一个为：益达或益隆', {icon: 2});
        return false;
    }

    if(supplierName=='益达'||supplierName=='益隆'){
        $('#tare').val( weight);
        $('#tareP').val(people);
        $('#tareTime').val( time);
        $('#tareSite').val(position);
    }
    //收货商：采购业务,毛重,毛重时间，毛重司磅员
    if(customerName=='益达'||customerName=='益隆'){
        $('#gross').val( weight);
        $('#grossWeightP').val(people);
        $('#grossTime').val( time)
        $('#grossWeightSite').val(position);
    }
    if(car!=''){
        var pre = car.substring(0,1)
        var last = car.substring(1);
        $('#main-plate-no-pre').find('option[value='+pre+']').attr("selected",true);
        $('#carId-f').val(last);
    }
    //物料
    $('#measureId').val(measureId);
    //供应商：销售业务,皮重,皮重时间，皮重司磅员
    $.ajax({
        url : '/car-check/'+car,
        async: false,
        success: function(data){
            var url = '/car-add/'+data.car.toUpperCase();
            var index = layer.open({
                title:'车辆新增',
                type: 2,
                closeBtn:1,
                area: ['900px', '600px'],
                fixed: false, //不固定
                maxmin: false,
                content: url
            });
            // if(-1==data.code){
            //     var url = '/car-add/'+data.car;
            //     var index = layer.open({
            //         title:'车辆新增',
            //         type: 2,
            //         closeBtn:0,
            //         area: ['800px', '600px'],
            //         fixed: false, //不固定
            //         maxmin: false,
            //         content: url
            //     });
            // }else{
            //     var carObj = data.obj;
            //     $('#max').val(carObj.careWeight);
            //     var grossA = $('#gross').val();
            //     var max = carObj.careWeight;
            //     if(parseFloat(grossA)>parseFloat(max)){
            //         layer.msg("该车已经超载，不能计量", {icon: 1});
            //         init();
            //         $('#incollection').removeClass("disabled");
            //     }else{
            //         $('#source').show();
            //         $('#incollection').addClass("disabled");
            //         $('#save').removeClass("disabled");
            //     }
            // }
        }
    });


})